﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace kostenbuch
{
    /// <summary>
    /// Interaktionslogik für Window1.xaml
    /// </summary>
    public partial class form : Window
    {
        MainWindow mw = new MainWindow();
        
        public form()
        {
            InitializeComponent();
        }

        private void Button_Click_Hinzufügen(object sender, RoutedEventArgs e)
        {
            Xml_Serializer xmlS = new Xml_Serializer();
            Eintrag ein_temp = new Eintrag();
            ein_temp.setTitle(tb_title.Text);
            ein_temp.setBetrag(double.Parse(tb_betrag.Text));
            ein_temp.setKategorie(tb_kategorie.Text);
            ein_temp.setMonatlich((bool)cb_monatlich.IsChecked);
            ein_temp.setNotiz(r.Text);
            
            XmlWriter.writeXml(ein_temp);
           

            MessageBox.Show("" + ein_temp.getNotiz());
            mw.eintragList.Add(ein_temp);
            this.Close();
        }

        private void Button_Click_Abbrechen(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        
    }
}
